package models;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Min;

import play.db.ebean.Model;
import util.TipoProva;

@Entity
public class Prova extends Model{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	public long id;
	
	public String descricao;
	
	public String temas;
	
	@Temporal(TemporalType.DATE)
	public Date dtCadastro;
	
	@Temporal(TemporalType.TIMESTAMP)
	public Date dtAbertura;
	
	@Temporal(TemporalType.TIMESTAMP)
	public Date dtEncerramento;
	
	@Min(0)
	public double peso;
	
	public int numQuest;
	
	public TipoProva tipo;
	
	public int dificuldadeMin;
	
	public int dificuldadeMax;
	
	public boolean status;

	// ------------------relacionamentos---------------------//
	@ManyToOne
	public Turma turma;
	
	@OneToMany(mappedBy="prova", fetch=FetchType.LAZY)
	public List<ProvaAluno> provaAlunos = new ArrayList<ProvaAluno>();

}
